<template>
       <ul class="todos">
            <li class="todos-item" v-for="(item,index) in arr">
                <div class="check">
                    <input type="checkbox">
                </div>
                <p class="content">{{item}}</p>
                <div class="close">
                    <b @click="delClick(item.index)">x</b>
                </div>
            </li>
       </ul> 
</template>
<script setup>
import mitts from "../utils/bus"
import {onMounted, ref} from "vue"
    let arr = ref([])
    let delClick = function(index){

        arr.value.splice(index,1)
    }
    onMounted(()=>{
        mitts.$on("getSong",(input)=>{
            arr.value=input
            console.log(input)
        })
    })
</script>
<style scoped>
.todos-item {
    align-items: center;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    height: 30px;
    margin: 10px 0;
    padding: 8px 10px 8px 8px;
}
li {
    text-align: -webkit-match-parent;
}
ul {
    list-style: none;
    margin: 0;
    padding: 0;
}
.content {
    overflow: hidden;
    padding-right: 7px;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 80%;
}
p {
    /* display: block;
    margin-block-start: 1em;
    margin-block-end: 1em;
    margin-inline-start: 0px;
    margin-inline-end: 0px; */
    text-emphasis: left;
}
</style>